package org.csu.mypetstoreplus.persistence;

import org.csu.mypetstoreplus.entity.Item;
import org.csu.mypetstoreplus.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ItemDao extends JpaRepository<Item, Integer> {
    @Query(value = "select * from item where productid =?1", nativeQuery = true)
    List<Item> findByProductId(String productId);

    @Query(value = "select * from item where itemid =?1 limit 1", nativeQuery = true)
    Item findByItemId(String itemId);
}
